package com.proxy.jdkproxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Classname JdkProxyHandler
 * @Description TODO
 * @Date 2021/8/24 0:14
 * @Created by 张斌
 */
public class JdkProxyHandler implements InvocationHandler {
    private Object target;

    public JdkProxyHandler(Object target) {
        this.target = target;
    }
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("JdkProxy start");
        Object ret = method.invoke(target, args);
        System.out.println("JdkProxy end");
        return ret;
    }
}
